package com.sky.mapper;

import com.sky.entity.AddressBook;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName: AddressBookMapper
 * Package: com.sky.mapper
 * Description:
 *
 * @Autehor 屈子岩
 * @Create 2024/10/13 14:51
 * @Version 1.0
 */
@Mapper
public interface AddressBookMapper {
    @Insert("insert into address_book (user_id, consignee, sex, phone, province_code, province_name, city_code, city_name, district_code, district_name, detail, label,is_default) " +
            "values (#{userId}, #{consignee}, #{sex} ,#{phone}, #{provinceCode}, #{provinceName}, #{cityCode}, #{cityName},#{districtCode}, #{districtName}, #{detail}, #{label}, #{isDefault})")
    void insert(AddressBook addressBook);

    void update(AddressBook addressBook);

    List<AddressBook> select(AddressBook addressBook);
    @Delete("delete from address_book where id =#{id}")
    void delecte(Long id);

    @Select("select * from sky_take_out.address_book where id =#{id}")
    AddressBook getbyId(Long addressBookId);
}
